package com.lvshi0797.cms.dao;

import java.util.List;

import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import com.lvshi0797.cms.entities.FMember;

@Repository("memberInfoDao")
public class MemberInfoDao extends BaseDao<FMember> implements IMemberInfoDao {

	 

	@Override
	public List<FMember> listMemberByBid(int bid) {
		 String sql = "select id,education,gender,identityCard,isDisable,isHuzhu,isInDibao,isInYanglao,isInYibao,memo,username,workstatus,disaCard,baseid from f_member m where m.baseid = ?";
		return this.listBySql(sql, bid, FMember.class, true);
	}

	 

	@Override
	public void updateMember(FMember member) {
		this.update(member);
	}



	@Override
	public void updateMember(int mid, int bid) {
		String sql = "UPDATE f_member SET baseid="+bid+" WHERE id="+mid;
		this.excuteBySql(sql);
	}



	@Override
	public FMember getById(int mid) {
		Session session = getSession();
		FMember member= (FMember)session.get(getClz(), mid);
		session.clear();
		return member;
	}

}
